//
//  PrivateMethod.h
//  MD5
//
//  Created by 金玉龙 on 15/11/17.
//  Copyright © 2015年 jinyulong. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;
typedef void(^voidBlock)(void);
@interface PrivateMethod : NSObject
/**
 *  16/32位MD5加密
 *
 *  @param string 需要加密的字符串
 *
 *  @return 加密后字符串
 */
+(NSString*)get16BitMD5StringFromString:(NSString*)string;
+(NSString*)get32BitMD5StringFromString:(NSString *)string;

/**
 *  获取设备UUID
 *
 *  @return UUID
 */
+(NSString*)getUUID;
/**
 *  时间NSString转成指定格式的NSDate
 *
 *  @param dateString  dateString 时间字符串
 *  @param formatStyle formatStyle 指定的格式
 *
 *  @return format之后的NSDate
 */
+ (NSDate *)dateFromString:(NSString *)dateString
           withFormatStyle:(NSString *)formatStyle;

/**
 *  时间NSString转成差量后的NSDate
 *
 *  @param dateString   dateString 时间字符串
 *  @param timeInterval timeInterval 时间差量
 *
 *  @return 改变之后的NSDate
 */
+ (NSDate *)getNotificationMatchDate:(NSString *)dateString
                  addingTimeInterval:(NSTimeInterval)timeInterval;

/**
 *  <#Description#>
 *
 *  @param dateTimeStr <#dateTimeStr description#>
 *
 *  @return <#return value description#>
 */
+(NSDate *)dateFromString:(NSString *)dateTimeStr;


/**
 *  NSDate转成指定格式的时间NSString
 *
 *  @param date        date NSDate
 *  @param formatStyle formatStyle 指定的格式
 *
 *  @return <#return value description#>
 */
+ (NSString *)dateStringFromDate:(NSDate *)date
                 withFormatStyle:(NSString *)formatStyle;


/**
 *  今天偏移offset天数并转化为 yyyy-MM-dd weekday 的格式
 *
 *  @param offset <#offset description#>
 *
 *  @return <#return value description#>
 */
+ (NSString *)dateStringDescriptionByTimeOffset:(NSInteger)offset;


/**
 *  时间字符串截取 MM-dd HH:ss
 *
 *  @param dateString <#dateString description#>
 *
 *  @return <#return value description#>
 */
+ (NSString *)formatterHHhhDate:(NSString *)dateString;


+ (NSString *)formatterDateString:(NSString *)dateString
                    fromFormatter:(NSString *)fromeStyle
                      toFormatter:(NSString *)toStyle;

//  比赛显示时间
+ (NSString *)matchShowTime:(NSString *)dataString;

//*月*日
+ (NSString *)formatterMMDDDate:(NSString *)dateSting;


+ (NSString *)formatterMMDDDateWithWeek:(NSString *)dateSting
                           fomaterStyle:(NSString *)fomaterStyle;


/**
 *  autolayout 设置父视图大小适应子视图
 *
 *  @param view
 */
+ (void)setFittingFrameWithView:(UIView *)view;


/**
 *  是否字符串全空格
 *
 *  @param string <#string description#>
 *
 *  @return <#return value description#>
 */
+ (BOOL)checkAllIsBlankSpace:(NSString *)string;


/**
 *  纯颜色image
 *
 *  @param color  <#color description#>
 *  @param width  <#width description#>
 *  @param height <#height description#>
 *
 *  @return <#return value description#>
 */
+ (UIImage *)imageFromColor:(UIColor *)color
                      Width:(int)width
                     Height:(int) height;

/**
 *  UIView转图片
 *
 *  @param view <#view description#>
 *
 *  @return <#return value description#>
 */
+ (UIImage *)imageFromView:(UIView *)view;


/**
 *  毛玻璃模糊图片
 *
 *  @param image 原始图片
 *  @param blur  0.0 - 0.1
 *
 *  @return <#return value description#>
 */
+ (UIImage *)blurryImage:(UIImage *)image withBlurLevel:(CGFloat)blur;

///**
// *  menu菜单栏数组
// *
// *  @param array <#array description#>
// *  @param type  <#type description#>
// *
// *  @return <#return value description#>
// */
//+ (NSMutableArray *)getMenuList:(NSArray *)array withType:(MenuType)type;


/**
 *  字符串转色值
 *
 *  @param hexColorString <#hexColorString description#>
 *
 *  @return <#return value description#>
 */
+ (UIColor *)colorWithHexColorString:(NSString *)hexColorString;

/**
 *  时长格式化 HH:ss:mm
 *
 *  @param totalTime <#totalTime description#>
 */
+ (NSString *)totalTimeText:(CGFloat)totalTime;

//  得到屏幕快照
+ (UIImage *)getScreenShot;

+ (void)version;
//  网络状态 0： 无网络  1： wifi  4： 3g/2g
//extern NSInteger NetConnectionStatus();

+ (void)showLoading;

+ (void)hiddenLoading;

+ (NSData *)dataWithImage:(UIImage *)image scaledToSize:(CGSize)newSize;

+ (UIImage *)imageCompressForWidth:(UIImage *)sourceImage targetWidth:(CGFloat)defineWidth;
+ (void)buttonSetTitleAndImageEges:(UIButton *)button;

/**
 *  Controller右上角添加搜索功能
 *
 *  @param vc
 *  @param selector
 */
+ (void)addRightBarButtonItemForSearchInController:(UIViewController *)vc
                                      withSelector:(SEL)selector;

/**
 *  拼接图片
 *
 *  @param path          原地址
 *  @param pathComponent 需要拼接的地址
 *
 *  @return 真正图片地址
 */
+ (NSString *)regularImagePath:(NSString *)path andWithPathComponent:(NSString *)pathComponent;

/**
 *  getUnixStamp 获取当前时间戳
 *
 *  @param NSString
 *  @param NSString
 */
+(NSString*)getUnixStamp;

+(CGSize)sizeForString:(NSString *)string font:(UIFont *)font size:(CGSize)size;
/**
 *  TouchId
 *
 *  @param authenticSuccess 认证成功回调
 *  @param authenticFailure 认证失败回调
 */
+ (void)authenticTouchIdSuccess:(voidBlock)authenticSuccess failure:(voidBlock)authenticFailure;
/**
 *  获取纯色image
 *
 *  @param colors color
 *  @param frame  frame
 *
 *  @return image
 */
+ (UIImage *)bgImageFromColors:(NSArray*)colors withFrame:(CGRect)frame;
@end
